using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DocLibApp
{
    public partial class FormRegister : FormBase
    {
        public FormRegister()
        {
            InitializeComponent();
        }

        private void btnPurchase_Click(object sender, EventArgs e)
        {
            util.RunFile(def.URL_Purchase);
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
            string lic_user = txtUser.Text.Trim();
            string lic_num = txtNumberOfLicense.Text.Trim();
            string lic_key = txtKey.Text.Trim();
            string lic_company = txtCompany.Text.Trim();

            if (string.IsNullOrEmpty(lic_user) || string.IsNullOrEmpty(lic_num) || string.IsNullOrEmpty(lic_key))
            {
                ShowMessage("You need to fill in user, number of license & license key in order to register, please try again.");
            }
            else
            {
                ShowMessage(doc_system.RegisterDocLibrary(lic_user, lic_company, lic_num, lic_key));
                ShowMessage("You will need to close the system and restart to verify the registration detail."
                    + System.Environment.NewLine + "Program will close now.");
                this.Close();
                Application.Exit();
            }
        }
    }
}